<?php

enum Suit
{
    case Hearts;
    case Diamonds;
    case Clubs;
    case Spades;
}


function getCard(Suit $suit): string
{
    return $suit->name;
}

var_dump(Suit::cases());
var_dump(Suit::Hearts);
var_dump(getCard(Suit::Diamonds));


enum BackedSuit: int
{
    case Hearts = 0;
    case Diamonds = 1;
    case Clubs = 2;
    case Spades = 3;

    const HEARTS = self::Hearts;

    public function color(): string
    {
        return match($this) {
            self::Hearts, self::Diamonds => 'Red',
            self::Clubs, self::Spades => 'Black',
        };
    }
}

print_r(BackedSuit::cases());
var_dump(BackedSuit::Diamonds);
var_dump(BackedSuit::Diamonds->name);
var_dump(BackedSuit::Diamonds->value);
var_dump(BackedSuit::Diamonds->value + 1);
var_dump(BackedSuit::HEARTS instanceof BackedSuit);
var_dump(BackedSuit::HEARTS instanceof Suit);
var_dump(BackedSuit::HEARTS->color());
